package com.jack.lib.core.help

import androidx.viewpager2.widget.ViewPager2

/**
 * author : chong.huang
 * create : 2022/1/9
 * desc   :
 */
class SimplePageChangeCallback(private val onPageSelected: (position: Int) -> Unit) : ViewPager2.OnPageChangeCallback() {

    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
        super.onPageScrolled(position, positionOffset, positionOffsetPixels)
    }

    override fun onPageSelected(position: Int) {
        super.onPageSelected(position)
        onPageSelected.invoke(position)
    }

    override fun onPageScrollStateChanged(state: Int) {
        super.onPageScrollStateChanged(state)
    }
}